package game.ui.controls
{
	import com.greensock.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
	
	import game.ui.core.*;
	import game.ui.data.*;
	import game.ui.events.*;
	import game.ui.layouts.*;
	
	public class RxDataGrid extends RxUIElement
	{
		private var m_dataProvider:RxIDataCollection;
		private var m_childContainer:Sprite;
		private var m_scrollBar:RxScrollBar;
		private var m_itemRendererClass:Class;
		private var m_itemRendererFunction:Function;
		private var m_freeRenderers:Vector.<RxUIElement>;
		private var m_visibleRenderers:Vector.<int>;
		private var m_indexToRenderer:Array;
		private var m_layout:RxILayout;
		private var m_lastMouseY:int;
		private var m_lastMousePoint:Point;
		private var m_currentTween:TweenLite;
		private var m_selectedIndex:int = -1;
		private var m_selectionMode:String = "none";
		private var m_pageScrolling:Boolean = false;
		private var m_hoverMode:Boolean = false;
		private var m_triggerSelectOnDownEvent:Boolean = true;
		private var m_drawMouseShield:Boolean = true;
		
		public function RxDataGrid(param1:RxIDataCollection, param2:RxILayout, param3:Class, param4:Function = null)
		{
			this.m_itemRendererClass = param3;
			this.m_itemRendererFunction = param4;
			this.m_indexToRenderer = [];
			this.m_freeRenderers = new Vector.<RxUIElement>;
			this.m_visibleRenderers = new Vector.<int>;
			this.m_childContainer = new Sprite();
			addChild(this.m_childContainer);
			this.m_layout = param2;
			if (this.m_layout)
			{
				this.m_layout.SetDataGrid(this);
			}
			this.SetDataProvider(param1);
			addEventListener(MouseEvent.MOUSE_WHEEL, this.OnMouseWheel, false, 0, true);
		}
		
		public function SetDataProvider(param1:RxIDataCollection) : void
		{/*
			if (this.m_dataProvider)
			{
				this.m_dataProvider.removeEventListener(RxDataProviderEvent.ITEM_REMOVED, this.OnDataItemRemoved);
				this.m_dataProvider.removeEventListener(RxDataProviderEvent.ITEM_ADDED, this.OnDataItemAdded);
			}
			this.m_dataProvider = param1;
			if (this.m_dataProvider != null)
			{
				this.m_dataProvider.addEventListener(RxDataProviderEvent.ITEM_REMOVED, this.OnDataItemRemoved);
				this.m_dataProvider.addEventListener(RxDataProviderEvent.ITEM_ADDED, this.OnDataItemAdded);
			}
			if (!this.m_layout)
			{
				return;
			}
			this.RemoveAllChildren();
			this.DrawMouseShield();
			if (this.m_dataProvider)
			{
				this.m_layout.SetNumItems(this.m_dataProvider.GetLength());
				this.scrollPosition = 0;
				this.m_layout.UpdateScrollRect();
				this.SetScrollBarComponent(this.m_scrollBar, this.m_pageScrolling);
			}
			else
			{
				this.m_layout.SetNumItems(0);
			}
			if (hasEventListener(Event.RESIZE))
			{
				dispatchEvent(new Event(Event.RESIZE));
			}
			*/
		}
		
		private function OnMouseWheel(e:MouseEvent) : void
		{
			
		}
	}
}